#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main(int argc,char* argv[])
{
    time_t t=time(0);
    srand(t);
    int i=10,r=0,f=0;
    while(i)
    {
        int fu = rand()%4;
        int a =rand()%10+1;
        int b =rand()%10+1;
        int d =0;
        int daan = 0;
        switch (fu)
        {
        case 1:
            printf("%d+%d\n",a,b);
            printf("请输入答案：");
            scanf("%d",&daan);
            d=daan == (a+b);
            break;
        case 2:
            printf("%d-%d\n",a,b);
            printf("请输入答案：");
            scanf("%d",&daan);
            d=daan == (a-b);
            break;
        case 3:
            printf("%d*%d\n",a,b);
            printf("请输入答案：");
            scanf("%d",&daan);
            d=daan == (a*b);
            break;
        default:
            printf("%d/%d\n",a,b);
            printf("请输入答案（只取整）：");
            scanf("%d",&daan);
            d=daan == (a/b);
            break;
        }
        if(d)
        {
            printf("正确\n");
            r++;
        }
        else
        {
            printf("错误\n");
            f++;
        }


        i--;
    }
    printf("您答对了%d道题\n您答错了%d道题\n",r,f);
    return 0;
}